import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import App from './App.vue'
import router from './router'
import store from './store'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
Vue.config.productionTip = false

Vue.use(ElementUI);
Vue.prototype.axios = axios;
axios.defaults.baseURL = '/api'
axios.defaults.headers.post['Content-Type']='application/json'  

axios.interceptors.request.use(config => {
  NProgress.start();
return config;
},error => {
// Do something with request error
return Promise.reject(error);
});

axios.interceptors.response.use(response => {
  NProgress.done();
return response;
},error => {
// Do something with response error
return Promise.reject(error);
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
